import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
	state: {
		user: {
			isLogin: false
		},
		errorList: [],
		addressList: [],
		baseUrl: ""
	},
	mutations: {
		fetchCurrentUser(state, rawData) {
			state.user = {
				isLogin: true,
				...rawData
			}
		},
		setUrl(state, baseUrl) {
			state.baseUrl = baseUrl
		},
		clearUser(state) {
			state.user = {
				isLogin: false,
			}
		},
		addAddress(state, val) {
			state.addressList.push(val)
		}
	},
	getters: {
		getUser(state) {
			return state.user
		},
		getUrl(state) {
			return state.baseUrl
		},
	},
	actions: {}
})